let express = require('express');
let cors = require('cors');
const path = require('path'); // 需要先引入path模块


let bodyParser = express.json();

let port = 3001;
let app = express();
app.use(express.static(path.join(__dirname, '../public'))); // 指向上级目录的public
app.use(cors());
app.use(bodyParser);

app.listen(port, () => {
  console.log('server is running on port ' + port);
});

//用户路由
app.use('/api/users', require('./routes/users'));

//公告路由
app.use('/api/notices', require('./routes/notices'));

//用户报告事件路由
app.use('/api/trafficReports', require('./routes/traffic_report'))

